<html> 
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>   
<body>    
    <h1>Hello ${user.name} !</h1> 
    <input type="text" class="input-text" value="${user.name}" placeholder="" id="adminName" name="adminName"/>
    <#-- 条件判断 true 执行if代码，false 执行 else代码 -->
    <#if user.name="aaa">
    	<input type="text" value="aaaaaa" id="aaa" name="aaa"/>
    <#else>
    	<h1>名字不对</h1>
    </#if>
    <#switch user.name> 
	<#case "aaa"> 
		 <h2>名字aaa</h2>
		<#break> 
	<#case "22"> 
		<h2>名字222</h2>
	<#break> 
	<#case "张晓明"> 
		<h2>正确啦</h2>
	<#break> 
	<#default> 
		<h2>默认输出</h2>
	</#switch>
	
	<#assign l=[0, 1 ,2 ,3 ,4, 5 ,6 ,7, 8 ,89 ,100,12,15,22]/>
	</br>数组长度：${l?size}</br>
	<#assign c= [1,2,3,4,5,6,6,7]> 
	<#list c[1..3] as v> 
	${v} ,
	</#list>c
	</br>
	<#list l as a>
	${a},
	</#list>
	</br>
	<#assign aa= "自定义字符"> 
	${aa}
	<#assign b= {"a":11,"b":22,"c":123.111}> 
	${b.a}
	
	#{b.c;m1}</br>
	<#assign cname=r"特殊字符完成输出(http:\www.baidu.com)">
	${cname}
	</br>
	<#-- 定义一个字符串 -->
	<#assign rename="aabBccdDeeFfgg"> 
	${rename[2]} <#-- 取字符串里面的第三个字符，下标从0开始 -->
	</br>
	${rename[2..6]}<#-- 取字符串里面的第三个 - 第6个字符，下标从0开始 -->
	<H3>判断使用</h3>
	<#-- 判断表达式如果为 false则输出 ‘’里面的值，否则输出原有值 -->
	<input type="text" id="acId" name="acId" value="${rename!''}"/>	
	<br/>
	第一个字母大写：${rename?cap_first}</br>
	所有字母大写：${rename?lower_case}</br>
	所有字母小写:${rename?upper_case}</br>
	算数运算：
	<#-- 支持"+"、"－"、"*"、"/"、"%"运算符 -->
	<#assign number1 = 10>
	<#assign number2 = 5><br/>
	加法："${number1} + ${number2} = " : ${number1 + number2}<br/>
	减法："${number1} － ${number2} = " : ${number1 - number2}<br/>
	乘法："${number1} * ${number2} = " : ${number1 * number2}<br/>
	除法："${number1} / ${number2} = " : ${number1 / number2}<br/>
	取余："${number1} % ${number2} = " : ${number1 % number2}<br/>
	
	比较运算符：<br/>
	<#if number1 + number2 gte 12 || number1 - number2 lt 6>
	"*" : ${number1 * number2}
	<#else>
	"/" : ${number1 / number2}
	</#if>
	<#assign number1 = 10.222>
	</br>取整：${number1?int}</br>
	保留 n 位小数：#{number1;m2}</br>
	
	时间格式化：
	<#assign date1="2009-10-12"?date("yyyy")>
	${date1?string("yyyy-MM-dd")}	
	
	<#if aaa??>
		<#list users as user >
		${user.id} - ${user.name}
		</#list>
	<#else>
		${aaa!"变量为空则给一个默认值"}
	</#if></br>
	<h3>map 集合</h3>
	<#assign bMap = {"aa":"aaaa","b":"bbbbb","c":"cccc","d":"dddd"}/>
	直接通过Key获取 Value值：${bMap["aa"]}</br>
	通过Key遍历Map：</br>
	<#list bMap?keys as key>
		${bMap[key]}</br>
	</#list>
	
	<h3>list集合处理</h3>
	<#assign bList = [{"a":111,"b":222,"c":333},{"a":444,"b":555,"c":666}]/>
	<#list bList as bl>
		<#assign item = bl>    
		<#list item?keys as key>
			${item[key]} :
		</#list></br>
	</#list>
	
	
	

</body>    
</html>   
 